package net.sakz.oss;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.web.servlet.FilterRegistrationBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;

import com.springframework.session.MapSessionRepository;
import com.springframework.session.Session;
import com.springframework.session.web.http.SessionRepositoryFilter;

@Configuration
public class OSSWebMvcConfigurerAdapter extends WebMvcConfigurerAdapter {

	
	    @Bean  
	    public FilterRegistrationBean filterRegist2() {  
	        FilterRegistrationBean frBean = new FilterRegistrationBean();
	        MapSessionRepository map=new MapSessionRepository();
	        SessionRepositoryFilter<Session> filter=new SessionRepositoryFilter<Session>(map);
	        frBean.setFilter(filter);
	        frBean.addUrlPatterns("/*");
	        frBean.setEnabled(true);
	        frBean.setOrder(-1);
	        return frBean;  
	    }  
}
